home *** CD-ROM | disk | FTP | other *** search
- Path: in1.uu.net!demos!usenet
- From: Alexey Ruzin <00alex@demos.su>
- Newsgroups: comp.lang.c++
- Subject: BC 3.1 - 4.5 (error!?)
- Date: Tue, 16 Apr 1996 21:17:28 +0400
- Organization: Demos Online Service
- Message-ID: <3173D628.48F6@demos.su>
- NNTP-Posting-Host: 00alex@dbs.demos.su
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)
-
- Hi, All
-
- Here is simple example of abnormal programming.
- But BC crashed (sorry, it works and even compiles
- the program, but it is unpredictable what will occur)
- on it:
-
- #include <stdio.h>
-
- int st_func( int a )
- {
- static int p=a;
- return p++;
- }
-
- int main( int argc, char *argv[] )
- {
- int i;
- if( argc != 1 )
- {
- for( i = 10; i>0; i-- )
- printf( "%d\n", st_func( i ) );
- }
- else
- {
- for( i = 0; i<10; i++ )
- printf( "%d\n", st_func( i ) );
- }
- return 0;
- }
-
- Enjoy...
-
- If you know what is wrong reply please :)
-